//
//  MCAfterSalePageViewController.swift
//  StoreManage
//
//  Created by MC on 2018/2/2.
//  Copyright © 2018年 MC. All rights reserved.
//

import UIKit

class MCAfterSalePageViewController: MCPageViewController {

    var navBarLineImageView : UIImageView? = nil
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navBarLineImageView?.isHidden = true
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navBarLineImageView?.isHidden = false
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        baseSetting()
        
        initUI()
        
        sendNetworking()
    }
    
    // MARK: - System Delegate
    
    // MARK: - Custom Delegate
    
    // MARK: - Action
    @objc func leftItemClicked() {
        self.navigationController?.popViewController(animated: true)
    }

    // MARK: - Network
    func sendNetworking() {
        
    }
    
    // MARK: - Method
    func baseSetting() {
        self.title = "售后订单管理"
        self.view.backgroundColor = UIColor.white
        self.navBarLineImageView = MCFindNavigationBarLine(view: (self.navigationController?.navigationBar)!)
        
        
        navigationItem.leftBarButtonItem = MCSetBarButtonItem_image(#imageLiteral(resourceName: "Reuse_back"), target: self, selector: #selector(leftItemClicked),isLeft: true)        
    }
    
    func initUI() {
        let titleArray = ["全部","待处理","待退货","待退款","已拒绝","已完成"]
        
        let vc1 = MCAfterSaleListViewController()
        let vc2 = MCAfterSaleListViewController()
        let vc3 = MCAfterSaleListViewController()
        let vc4 = MCAfterSaleListViewController()
        let vc5 = MCAfterSaleListViewController()
        let vc6 = MCAfterSaleListViewController()

        vc1.status = 0
        vc2.status = 1
        vc3.status = 5
        vc4.status = 2
        vc5.status = 4
        vc6.status = 3

        vc1.delegate = self
        vc2.delegate = self
        vc3.delegate = self
        vc4.delegate = self
        vc5.delegate = self
        vc6.delegate = self

        let vcArray = [vc1,vc2,vc3,vc4,vc5,vc6]
        
        self.initWithTitleArray(titleArray, vcArray: vcArray, blockNormalColor: UIColor.MCGray_middle, blockSelectedColor: UIColor.MCMain, currentPage: 0)        
    }
    
    // MARK: - Setter & Getter
}


extension MCAfterSalePageViewController : MCAfterSaleListViewControllerDelegate {
    func MCAfterSaleListViewControllerPushTo(viewController: UIViewController) {
        MCPushToViewController(current: self, target: viewController, isHiddenBottomBarWhenBack: true)
    }
}
